unit UFormPaises;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TFormPaises = class(TForm)
    Label1: TLabel;
    EditNomePais: TEdit;
    Label2: TLabel;
    EditSiglaPais: TEdit;
    Label3: TLabel;
    EditBandeiraPais: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormPaises: TFormPaises;

implementation

uses UDMPrincipal;

{$R *.dfm}

procedure TFormPaises.Button1Click(Sender: TObject);
begin
  if((Trim(EditNomePais.Text) = '') or (Trim(EditSiglaPais.Text) = ''))then
  begin
    if(Trim(EditNomePais.Text) = '')then
    begin
      ShowMessage('O campo Nome do Pais deve ser preenchido.');
    end;

    if(Trim(EditSiglaPais.Text) = '')then
    begin
      ShowMessage('O campo Sigla do Pais deve ser preenchido.');
    end;
  end
  else
  begin
    DMPrincipal.ClientDataSet1.Post;
    DMPrincipal.ClientDataSet1.ApplyUpdates(-1);
    Close;
  end;
end;

procedure TFormPaises.Button2Click(Sender: TObject);
begin
  DMPrincipal.ClientDataSet1.CancelUpdates;
  Close;
end;

end.
